﻿using System;
using System.Text;
using System.Configuration;

namespace Custom
{
	public static class Config
	{
		private static QueryEngine engine = null;
		public static QueryEngine Engine
		{
			get
			{
				if (engine == null)
				{
					DateTime time = DateTime.Now;
					Logger.append("tworze system wyszukiwania\n", Logger.INFO);
					engine = new QueryEngine(BasePath,"wikipedia.txt",TeleportProbability,PageRankScore,TitleCountScore,TextCountScore,WordDistanceScore);
					Logger.append(string.Format("utworzono system wyszukiwania: czas {0}\n",(DateTime.Now-time).Seconds.ToString("0.0000")),
						Logger.INFO);
				}
				return engine;
			}
		}
		public static int PerPage
		{
			get { return 10; }
		}
		public static string BasePath
		{
			get 
            {
                try
                {
                    return ConfigurationSettings.AppSettings["baseDir"];
                }
                catch
                {
                    return AppDomain.CurrentDomain.BaseDirectory;
                }
            }
		}

		public static double TeleportProbability
		{
			get { return double.Parse(ConfigurationSettings.AppSettings["teleProb"]); }
		}

		public static double PageRankScore
		{
			get { return double.Parse(ConfigurationSettings.AppSettings["pageRankScore"]); }
		}

		public static double TitleCountScore
		{
			get { return double.Parse(ConfigurationSettings.AppSettings["titleCountScore"]); }
		}

		public static double TextCountScore
		{
			get { return double.Parse(ConfigurationSettings.AppSettings["textCountScore"]); }
		}

		public static double WordDistanceScore
		{
			get { return double.Parse(ConfigurationSettings.AppSettings["wordDistanceScore"]); }
		}

	}
}